import request from '@/utils/request'

enum Api {
  list = '/device/loadList',
  save = '',
  edit = '',
  delete = '',
  upload = '',
  import = '/device/importData',
  export = ''
}

/**
 * 导入
 * @param data
 */
export const importXlsx = async (data: FormData) => {
  return await request.post(Api.import, {
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**
 * 列表
 * @param data
 */
export const list = async (data: {
  pageNum: number
  pageSize: number
  name: string
  voltageLevel?: undefined | string
  typeName?: undefined | string
  status?: undefined | string
}) => {
  return await request.post(Api.list, { data })
}

/**
 * 电压等级
 * @param
 */
export const voltage = async () => {
  return await request.get('/device/getVoltageLevelList')
}

/**
 * 设备类型
 * @param
 */
export const device = async () => {
  return await request.get('/device/getDeviceTypeList')
}
